package com.edisoncgh.service.impl;

import com.edisoncgh.dao.ManagerMapper;
import com.edisoncgh.dao.UserMapper;
import com.edisoncgh.pojo.Manager;
import com.edisoncgh.pojo.ManagerExample;
import com.edisoncgh.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ManagerServiceImpl implements ManagerService {
    private ManagerMapper managerMapper;

    @Autowired
    public void setManagerMapper(ManagerMapper managerMapper) {
        this.managerMapper = managerMapper;
    }

    @Override
    public boolean addManager(Manager manager) {
        return managerMapper.insert(manager)>0;
    }

    @Override
    public boolean deleteManagerById(Integer id) {
        return managerMapper.deleteByPrimaryKey(id)>0;
    }

    @Override
    public boolean updateManager(Manager manager) {
        return managerMapper.updateByPrimaryKey(manager)>0;
    }

    @Override
    public Manager findManagerById(Integer id) {
        return managerMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Manager> findAllManager() {
        ManagerExample managerExample = new ManagerExample();
        return managerMapper.selectByExample(managerExample);
    }
}
